Repository navigation
Stop deploy/opensearch/operator.py shadowing the stdlib operator module - #601
Merged
Merged
Conversation
Scripts in deploy/opensearch run with that folder first on sys.path, so Python's own `import operator` (from collections, at startup) loaded the repository's operator.py and failed with a circular-import ImportError. It stayed hidden only because the shared package's editable-install .pth happens to import collections before the script folder is added. Rename the module to native_operator.py, the name workload_snapshot.py already loads it under, and update every reference. The launch-issuer kind stays `operator`, so installed backup services keep their command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scripts in
deploy/opensearchrun with that folder first onsys.path. Python's owncollectionsmodule importsoperatorat startup, which resolved to ourdeploy/opensearch/operator.py:It stays hidden in the usual workspace environment only because the shared package's editable-install
.pthimportscollectionsbefore the script folder is added to the path. Any environment without that.pthcrashes: a bare virtualenv,python -S, or a non-editable install.The
launch-issuer.py --kind operatorname is unchanged, so generated backup services keep the same command line. Thetransition_script_sha256checks hashscripts/probes/manage-opensearch-transition.py, which this PR does not touch.Evidence
main, Python 3.12, same packages, no.pthprocessing):deploy/opensearch/testssuite on Python 3.12 in the workspace environment: 135 passed on bothmainand this branch. The one remaining failure,test_offline_admission, needs application settings (DATABASE_URL,TMP_PATH) and fails the same way onmain.Merge Danger
Door: two-way
A file rename with reference updates. Reverting restores the old name.
Blast Radius: operator-commands
Operators who run the script by name now type
native_operator.py fence-hostand similar. The README is updated. Hosts using an older reviewed checkout keep the old file name until their checkout is updated. Commands that go throughlaunch-issuer.py --kind operatorresolve the new path once the checkout includes this change.🤖 Generated with Claude Code